package com.pig4cloud.pig.module.api.entity.product;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.*;
import com.pig4cloud.pig.module.api.entity.dto.AttrValueDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;

/**
 * 商品属性对象 product_attr
 *
 * @author ruoyi
 * @date 2021-08-11
 */
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@TableName("product_attr")
public class ProductAttr implements Serializable {

    /**
     * $column.columnComment
     */
    @TableId(value = "id",type = IdType.AUTO)
    private Long id;

    /**
     * 商品ID
     */
    private Long productId;

    /**
     * 属性名
     */
    private String attrName;

    /**
     * 属性值
     */
    private String attrValues;

    @TableField(exist = false)
	@ApiModelProperty(value = "属性值集合")
	private List<AttrValueDto> attrValue;

	@TableField(exist = false)
	@ApiModelProperty(value = "属性")
	private List<String> attrValueArr;



	public void copy(ProductAttr source){
		BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
	}
}
